//
// Created by cjh on 2021/5/13.
//

#ifndef RESOURCE_PARSER_H
#define RESOURCE_PARSER_H
#include <string>
#include <vector>
#include <unordered_map>


struct http_head
{
    http_head();
    http_head(http_head&& h);
    http_head& operator=(http_head&& h);

    std::string method;
    std::string path;
    std::string version = "1.1";
    std::unordered_map<std::string, std::string> headers;

    std::string dump()const;
};

std::string render_head(const http_head& head);
void parse_head(const std::string& str, http_head& ret);

std::string render(const std::string& content="", int status=200,
                   const std::string& content_type = "text/html",
                   std::unordered_map<std::string,std::string> headers = {},
                   const std::string& http_version = "1.1");

#endif //RESOURCE_PARSER_H
